home *** CD-ROM | disk | FTP | other *** search
/ Essentials of Interactive Physiology / Essentials of Interactive Physiology.iso / pc / files / evaluation / evaluation.dcr / 00006_printMCEvaluationParent.ls < prev    next >
Encoding:
Text File  |  2002-04-02  |  3.8 KB  |  101 lines

  1. property piTicks, piTickdelay, psEvaluation, psHeader, psFooter, plLetters, pzWhich, piCurQuestion, piQuestionsPerStepFrame, plpTestQuestions, plQuestionsAnswerOrder, plFirstAnswer, plRightWrong, psOld, poOwner
  2.  
  3. on new me, xoOwner, xiTicks, xiQuestionBlock
  4.   poOwner = xoOwner
  5.   piTickdelay = xiTicks
  6.   piQuestionsPerStepFrame = xiQuestionBlock
  7.   plLetters = ["a", "b", "c", "d", "e"]
  8.   return me
  9. end
  10.  
  11. on mSetHeaderFooter me, xlChapters, xsType, xiBlockSize
  12.   if not voidp(xiBlockSize) then
  13.     piQuestionsPerStepFrame = xiBlockSize
  14.   end if
  15.   viNumChapters = count(xlChapters)
  16.   vsChapter = "<center>Chapter "
  17.   if viNumChapters > 1 then
  18.     vsChapter = "<center>Chapters: "
  19.   end if
  20.   vsChapterNum = getAt(xlChapters, 1)
  21.   repeat with i = 2 to viNumChapters
  22.     vsChapterNum = vsChapterNum & ", " & getAt(xlChapters, i)
  23.   end repeat
  24.   xsType = makeFirstLetterUpperCase(xsType)
  25.   psHeader = xsType & "#RETURN" & vsChapter & vsChapterNum & " " & xsType & "</center><BR><BR><BR><OL>"
  26.   psFooter = "</OL>"
  27. end
  28.  
  29. on stepFrame me
  30.   if the ticks > (piTicks + piTickdelay) then
  31.     piTicks = the ticks
  32.     if piCurQuestion <= count(plpTestQuestions) then
  33.       mSendData(me, piCurQuestion)
  34.       piCurQuestion = piCurQuestion + piQuestionsPerStepFrame
  35.     else
  36.       vsToPrint = psHeader & psEvaluation & psFooter
  37.       gotoNetPage("javascript:doPrintable(" & QUOTE & vsToPrint & QUOTE & ")")
  38.       deleteOne(the actorList, me)
  39.       the itemDelimiter = psOld
  40.       mNotify(poOwner, #printDone, 1)
  41.     end if
  42.   end if
  43. end
  44.  
  45. on mSendData me
  46.   repeat with i = piCurQuestion to piCurQuestion + piQuestionsPerStepFrame - 1
  47.     viCurChapter = getPropAt(plpTestQuestions, i)
  48.     viCurChapterQuestion = getAt(plpTestQuestions, i)
  49.     vsChapterQuestions = the text of field IntegerToString(viCurChapter, 2)
  50.     vsAQuestion = line viCurChapterQuestion of vsChapterQuestions
  51.     vlAnswerOrder = getAt(plQuestionsAnswerOrder, i)
  52.     vsResult = getAt(plRightWrong, i)
  53.     vsEvaluation = vsEvaluation & "<LI>" & item 1 of vsAQuestion & "<BR><BR>"
  54.     delete item 1 of vsAQuestion
  55.     vsAnswer = item 1 of vsAQuestion
  56.     delete item 1 of vsAQuestion
  57.     if vsAnswer <> EMPTY then
  58.       vlAnswerOrder = GetListFrom1toX(the number of items in vsAQuestion)
  59.       viRight = value(vsAnswer)
  60.     else
  61.       viRight = 1
  62.     end if
  63.     case pzWhich of
  64.       #clean:
  65.         vsEvaluation = vsEvaluation & "<OL TYPE=" & "a" & ">"
  66.         repeat with j = 1 to the number of items in vsAQuestion
  67.           viWhichAnswer = getAt(vlAnswerOrder, j)
  68.           vsEvaluation = vsEvaluation & "<LI>" & item viWhichAnswer of vsAQuestion
  69.         end repeat
  70.       #result:
  71.         vsEvaluation = vsEvaluation & "<OL>"
  72.         viAnswer = getAt(plFirstAnswer, i)
  73.         viLetterPos = getPos(vlAnswerOrder, viAnswer)
  74.         if viLetterPos then
  75.           vsEvaluation = vsEvaluation & "Your Answer: " & getAt(plLetters, viLetterPos) & ") " & item viAnswer of vsAQuestion & "<BR><BR>"
  76.         end if
  77.         if vsResult <> "right" then
  78.           vsEvaluation = vsEvaluation & "Correct Answer: " & getAt(plLetters, getPos(vlAnswerOrder, viRight)) & ") " & item viRight of vsAQuestion
  79.         end if
  80.     end case
  81.     vsEvaluation = vsEvaluation & "</OL><BR><BR>"
  82.   end repeat
  83.   vsEvaluation = SearchAndReplaceAll(vsEvaluation, QUOTE, """)
  84.   vsEvaluation = SearchAndReplaceAll(vsEvaluation, "'", "’")
  85.   psEvaluation = vsEvaluation
  86. end
  87.  
  88. on mPrintEvaluation me, xzWhich, xlpTestQuestions, xlQuestionsAnswerOrder, xlFirstAnswer, xlRightWrong
  89.   pzWhich = xzWhich
  90.   plpTestQuestions = xlpTestQuestions
  91.   plQuestionsAnswerOrder = xlQuestionsAnswerOrder
  92.   plFirstAnswer = xlFirstAnswer
  93.   plRightWrong = xlRightWrong
  94.   alert("The new window will take a moment to open.")
  95.   add(the actorList, me)
  96.   psOld = the itemDelimiter
  97.   the itemDelimiter = TAB
  98.   piCurQuestion = 1
  99.   piTicks = the ticks
  100. end
  101.